<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<div id="header" class="nav_menu">
    <nav role="navigation">
        <div class="nav toggle">
            <a id="menu_toggle"><i class="fa fa-bars"></i></a>
        </div>
        <ul class="nav navbar-nav navbar-right" ng-if="userLoaded">
            <li>
                <div class="btn-group" uib-dropdown is-open="userMenu.isopen">
                    <button id="userButton" type="button" class="btn btn-link" uib-dropdown-toggle>
                        <span id="headerUsername">{{::user.username}}</span> <i class="fa fa-angle-down fa-lg"></i>
                    </button>
                    <ul class="uib-dropdown-menu dropdown-usermenu animated fadeInDown" role="menu" aria-labelledby="userMenu-button">
                        <li><a ui-sref="trafficPortal.private.user.edit">Manage User Profile</a></li>
                        <li ng-if="userLoaded"><a ng-click="logout()">Logout</a></li>
                    </ul>
                </div>
            </li>
            <li role="presentation" class="dropdown">
                <div class="btn-group" title="Change Logs" uib-dropdown is-open="alerts.isopen">
                    <button id="alertsButton" type="button" class="btn btn-link" ng-click="getChangeLogs()" uib-dropdown-toggle>
                        <i class="fa fa-comment-o"></i>
                        <span class="badge bg-green">{{newLogCount()}}</span>
                    </button>
                    <ul class="uib-dropdown-menu list-unstyled msg_list animated fadeInDown" role="menu">
                        <li ng-show="loadingChangeLogs" style="text-align: center"><i class="fa fa-refresh fa-spin fa-1x fa-fw"></i></li>
                        <li ng-repeat="changeLog in changeLogs">
                            <a ng-click="$event.stopPropagation()">
                                <span>
                                    <span>{{::changeLog.user}}</span>
                                    <span class="time">{{::getRelativeTime(changeLog.lastUpdated)}}</span>
                                </span>
                                <span class="message">{{::changeLog.message}}</span>
                            </a>
                        </li>
                        <li>
                            <div class="text-center">
                                <a>
                                    <strong><a ng-click="navigateToPath('/change-logs')">See All Change Logs</a></strong>
                                    <i class="fa fa-angle-right"></i>
                                </a>
                            </div>
                        </li>
                    </ul>
                </div>
            </li>
            <li>
                <div class="btn-group" title="DB Dump">
                    <button type="button" class="btn btn-link" ng-click="dbDump()"><i class="fa fa-download"></i></button>
                </div>
            </li>
            <li>
                <div class="btn-group" title="Queue CDN Server Updates">
                    <button type="button" class="btn btn-link" ng-click="confirmQueueServerUpdates()"><i class="fa fa-flag"></i></button>
                </div>
            </li>
            <li>
                <div class="btn-group" title="Diff CDN Config Snapshot">
                    <button type="button" class="btn btn-link" ng-click="snapshot()"><i class="fa fa-camera"></i></button>
                </div>
            </li>
        </ul>
    </nav>
</div>
